// @FileName  :getprimenum.c
// @Time      :2024/2/29 19:32
// @Author    :YKW
//# include <bits/stdc++.h>
//using namespace std;
# include <stdio.h>
# include <stdlib.h>
# include <math.h>
# include <string.h>
# include <stdlib.h>

int isPrime(long long n) {
    for (int i = 2; i < sqrt(n); i++)
        if (n % i == 0)
            return 0;
    return 1;
}

int Palindrome(long long n) {
    int res = 0;
    while (n > 0) {
        res *= 10;
        res += n % 10;
        n /= 10;
    }
    return res;
}

void solve() {
    long long n;
    int flag = 0;
    scanf("%lld", &n);
    int nn = Palindrome(n);
    if (isPrime(n) && isPrime(nn))
        flag = 1;
    printf(flag == 1 ? "yes" : "no");
}

void main() {
    int t = 1;
//    scanf("%d", &t);
    while (t--) solve();
    return 0;
}